﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using GUESTSMANAGEMENT.Controller;
using System.Collections.Generic;
using Coolite.Ext.Web;

namespace GUESTSMANAGEMENT.View
{
    public partial class WebUserControl1 : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            
        }

        protected void Load(object sender, AjaxEventArgs e)
        {
            using (guestsmanagementEntities context = new guestsmanagementEntities())
            {

                var selectListGuests = from guestlists in context.gmlistguests.Include("gmuser.nmuser")
                                       from gevent in context.gmevent.Include("gmevent.nmevent")
                                       from user in context.gmuser.Include("gmuser.nmuser")
                                       from guests in context.gmguest.Include("gmguests.nmguests")
                                       where guestlists.GMUSER_CDUSER == user.CDUSER && guestlists.GMGUEST_CDGUEST == guests.CDGUEST && guestlists.GMEVENT_CDEVENT == gevent.CDEVENT
                                       select new { guestlists.CDLISTGUESTS, guests.NMGUEST, guests.NMPHONE, guests.NMMAIL, user.NMUSER, gevent.NMEVENT, gevent.DTEVENT };
                var lista = selectListGuests.ToList();

                if (!Ext.IsAjaxRequest)
                {
                    this.listStore.DataSource = lista;
                    this.listStore.DataBind();
                }
            }
        
        }

        protected void MyData_Refresh(object sender, StoreRefreshDataEventArgs e)
        {

        }
    }
}